on
To attach a callback for different states of the window.Predis object.
Usage
predis.on("ready", () => {
// SDK is ready to call other methods e.g createPost
});
predis.on("error", () => {
// catch if there is any error SDK initialization
});
Parameters
Name | Description | Type | Required |
---|---|---|---|
state | The state to attach a callback to. Possible value: ready , error | Object | yes |
callback | Function to execute when the state is triggered | Function | yes |